home *** CD-ROM | disk | FTP | other *** search
/ Aminet 30 / Aminet 30 (1999)(Schatztruhe)[!][Apr 1999].iso / Aminet / util / pack / xpk_Source.lha / xpk_Source / test / testCurrentTime.c < prev    next >
C/C++ Source or Header  |  1998-11-09  |  1KB  |  55 lines

  1. #define NAME        "testCurrentTime"
  2. #define DISTRIBUTION    "(Freeware) "
  3. #define REVISION    "1"
  4.  
  5. /* Programmheader
  6.  
  7.     Name:        testCurrentTime
  8.     Author:        SDI
  9.     Distribution:    Freeware
  10.     Description:    tests CurrentTime function
  11.     Compileropts:    -gM
  12.     Linkeropts:    -l amiga
  13.  
  14.  1.1   06.12.96 : added header
  15. */
  16.  
  17. #include <proto/intuition.h>
  18. #include <proto/exec.h>
  19. #include <proto/dos.h>
  20. #include "SDI_defines.h"
  21.  
  22. ULONG DosVersion = 37;
  23. struct Library *IntuitionBase = 0;
  24.  
  25. void main(void)
  26. {
  27.   ULONG sec, usec, sec0, usec0, tim;
  28.  
  29.   if((IntuitionBase = OpenLibrary("intuition.library",33)))
  30.   {
  31.     CurrentTime(&sec0, &usec0);
  32.     Printf("%lu %lu\n",sec0,usec0);
  33.  
  34.     while(!CTRL_C)
  35.     {
  36.       CurrentTime(&sec, &usec);
  37.       if(usec >= usec0)
  38.       {
  39.         sec = sec - sec0;
  40.         usec = usec - usec0;
  41.       }
  42.       else
  43.       {
  44.         sec = sec - sec0 - 1;
  45.         usec = usec + 1000000 - usec0;
  46.       }
  47.       tim = (sec<<7) + usec / (1000000>>7);
  48.  
  49.       Printf("%lu %lu %lu\n", sec, usec, tim);
  50.     }
  51.     CloseLibrary(IntuitionBase);
  52.   }
  53.   exit(0);
  54. }
  55.